package com.jeasonzhao.web;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import javax.servlet.ServletException;

public abstract class AbstractSimpleServlet extends AbstractServlet {
    private static final long serialVersionUID = 1L;
    public AbstractSimpleServlet() {
    }

    protected abstract String processContent(HttpServletRequest request,HttpServletResponse response);

    public void execute(HttpServletRequest request,HttpServletResponse response)
        throws IOException,ServletException {
        String s = processContent(request,response);
        if(null != s && null != response && s.trim().length() > 0) {
            response.getWriter().write(s);
        }
    }
}
